package com.todo.strategy.online.iface.request;

import com.todo.common.common.entity.CurrentUser;
import com.todo.common.common.enums.BizErrorCodeEnum;
import com.todo.common.common.exception.BizException;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.Date;
import java.util.List;

/**
 * @author azhebuxing
 * @date 2024/5/9 15:38
 * @description
 */
@Data
@Schema(title = "更新我想去入参", description = "更新我想去入参")
public class UpdateWantSetParam {

    private CurrentUser _user;

    @Schema(title = "我想去集合id", description = "我想去集合id")
    private Long wantId;

    @Schema(title = "我想去名称", description = "我想去名称")
    private String name;

    @Schema(title = "主图", description = "主图")
    private String mainImg;

    @Schema(title = "计划开始时间", description = "计划开始时间")
    private Date startPlanTime;

    @Schema(title = "计划结束时间", description = "计划结束时间")
    private Date endPlanTime;

    @Schema(title = "描述", description = "描述")
    private String desc;

    @Schema(title = "是否私有", description = "是否私有")
    private Integer isPrivate;

    @Schema(title = "计划城市列表", description = "计划城市列表")
    private List<String> planCityList;

    public boolean baseCheck() {
        if (wantId == null || name == null || mainImg == null || startPlanTime == null || endPlanTime == null || desc == null || isPrivate == null || planCityList == null){
            return false;
        }
        if (startPlanTime.after(endPlanTime)){
            throw new BizException(BizErrorCodeEnum.PARAM_ERROR,"开始时间晚于结束时间");
        }
        return true;
    }
}
